import pygame
import time_stamp
import os

IMAGE_DIR = 'img'

CLOCK = pygame.time.Clock()
TIME_STAMPER = time_stamp.TimeStamper()
PORT_NUM = 1124

SERVER_LOG_FILENAME = 'server_logs.txt'

#D_USER_ID = 'user_id'
D_KEY_MAPS = 'key_maps'
D_MOUSE_BUTTONS = 'mouse_buttons'
D_TIME_STAMP = 'time_stamp'
D_EVENT_BYTES_LIST = 'event_bytes_list'
D_FROM_HID = 'from_hid'
D_TO_HIDS = 'to_hids'
D_ID = 'id'
D_HP = 'hp'
D_LEVEL = 'level'
D_EXP = 'exp'
D_POW = 'power'
D_DEFE = 'defence'
D_POS = 'pos'
D_IDS = 'ids'

DIR_NORTH = 0
DIR_SOUTH = 1
DIR_WEST = 2
DIR_EAST = 3


def load_image(file):
    file_path = os.path.join(IMAGE_DIR, file)
    surface = None
    try:
        surface = pygame.image.load(file_path)
    except pygame.error:
        raise SystemExit("Can't load image file %s, will exit." % file_path )
    return surface.convert()